//
//  GKZYExpertLineCell.m
//  GKZYAid
//
//  Created by lanou3g on 16/3/7.
//  Copyright © 2016年 GKZYAid. All rights reserved.
//

#import "GKZYExpertLineCell.h"
#define KWidth self.frame.size.width
#define KHeight self.frame.size.height

@interface GKZYExpertLineCell ()

@property (nonatomic,strong)UILabel *labelName;
@property (nonatomic,strong)UILabel *labelWork;
@property (nonatomic,strong)UILabel *labelEvaluation;

@end

@implementation GKZYExpertLineCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self addViews];
    }
    
    return self;
}

- (void)setModel:(GKZYExpertLineModel *)model{
    
    self.expertEvaluation.text = model.evaluation;
    self.expertIMV.image = [UIImage imageNamed:model.image];
    self.expertNameLabel.text = model.name;
    self.expertPositionLabel.text = model.position;
}


- (void)addViews{
    
    self.expertIMV = [[UIImageView alloc]init];
    self.expertIMV.frame = CGRectMake(KWidth * 0.05, KHeight * 0.1, KWidth * 0.3, KHeight * 0.5);
    [self addSubview:self.expertIMV];
    
    
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button.frame = CGRectMake(KWidth * 0.09, KHeight * 0.65, KHeight * 0.3, KHeight * 0.3);
    self.button.layer.cornerRadius = self.button.frame.size.width/2;
    [self.button setTitle:@"咨询" forState:UIControlStateNormal];
    [self.button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.button.backgroundColor = [UIColor orangeColor];
    [self addSubview:self.button];
    
    self.labelName = [[UILabel alloc]init];
    self.labelName.frame = CGRectMake(KWidth * 0.37, KHeight * 0.15, KWidth * 0.15, KHeight * 0.2);
    self.labelName.text = @"姓名 :";
    [self addSubview:self.labelName];
    
    self.expertNameLabel = [[UILabel alloc]init];
    self.expertNameLabel.frame = CGRectMake(KWidth * 0.52, KHeight * 0.15, KWidth * 0.4, KHeight * 0.2);
    self.expertNameLabel.font = [UIFont systemFontOfSize:18];
    [self addSubview:self.expertNameLabel];
    
    self.labelWork = [[UILabel alloc]init];
    self.labelWork.frame = CGRectMake(KWidth * 0.37, KHeight * 0.4, KWidth * 0.15, KHeight * 0.2);
    self.labelWork.text = @"职位 :";
    [self addSubview:self.labelWork];
    
    
    
    self.expertPositionLabel = [[UILabel alloc]init];
    self.expertPositionLabel.frame = CGRectMake(KWidth * 0.52, KHeight * 0.4, KWidth * 0.4, KHeight * 0.2);
    [self addSubview:self.expertPositionLabel];
    
    
    self.labelEvaluation = [[UILabel alloc]init];
    self.labelEvaluation.frame = CGRectMake(KWidth * 0.4, KHeight * 0.7, KWidth * 0.15, KHeight * 0.2);
    self.labelEvaluation.text = @"星级 :";
    [self addSubview:self.labelEvaluation];
    
    self.expertEvaluation = [[UILabel alloc]init];
    self.expertEvaluation.frame = CGRectMake(KWidth * 0.55, KHeight * 0.7, KWidth * 0.4, KHeight * 0.2);
    [self addSubview:self.expertEvaluation];
    
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    self.expertIMV.frame = CGRectMake(KWidth * 0.05, KHeight * 0.1, KWidth * 0.3, KHeight * 0.5);
    self.button.frame = CGRectMake(KWidth * 0.09, KHeight * 0.65, KHeight * 0.3, KHeight * 0.3);
    self.button.layer.cornerRadius = self.button.frame.size.width/2;
    
    self.expertNameLabel.frame = CGRectMake(KWidth * 0.52, KHeight * 0.15, KWidth * 0.4, KHeight * 0.2);
    
    self.expertPositionLabel.frame = CGRectMake(KWidth * 0.52, KHeight * 0.4, KWidth * 0.4, KHeight * 0.2);
    self.expertEvaluation.frame = CGRectMake(KWidth * 0.55, KHeight * 0.7, KWidth * 0.4, KHeight * 0.2);
    self.labelName.frame = CGRectMake(KWidth * 0.37, KHeight * 0.15, KWidth * 0.15, KHeight * 0.2);
    self.labelWork.frame = CGRectMake(KWidth * 0.37, KHeight * 0.4, KWidth * 0.15, KHeight * 0.2);
    self.labelEvaluation.frame = CGRectMake(KWidth * 0.4, KHeight * 0.7, KWidth * 0.15, KHeight * 0.2);
    
    
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
